const express = require('express');
const router = express.Router();
const data = [];
for(let i = 1; i < 51; i++)
    data.push({
        id: `${i}`,
        code: `YS2019082700-${i}`,
        name: `申报要素-${i}`,
        countryName: '中国',
        englishName: 'englishName',
        status: 1,
        essentialFactor: 'string-essentialFactor',
        commodityDescription: 'string-commodityDescription',
        firstUnit: 'string-firstUnit',
        secendUnit: 'string-secendUnit',
        conditions: 'string-conditions',
        quarantineCategory: 'string-quarantineCategory',
        remark: 'string-remark',
        rowVersion: 'string',
        options: ['update', 'abandon']
    });
router.get('/forCurrentUser', (req, res) => {
    const {pageIndex, pageSize} = req.query;
    res.json({
        message: 'ok',
        payload: {
            content: data,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});

router.get('/:id', (req, res) => {
    res.json({
        message: 'ok',
        payload: {
            id: '1',
            code: 'YS2019082700-${i}',
            name: '申报要素-${i}',
            countryId: '1',
            countryName: '中国',
            englishName: 'englishName',
            status: 1,
            essentialFactor: 'string-essentialFactor',
            commodityDescription: 'string-commodityDescription',
            firstUnit: 'string-firstUnit',
            secendUnit: 'string-secendUnit',
            conditions: 'string-conditions',
            quarantineCategory: 'string-quarantineCategory',
            remark: 'string-remark',
            rowVersion: 'string',
            options: ['update', 'abandon'],
            details: [
                {
                    brandCode: '品牌01',
                    partId: '1',
                    partCode: 'partCode1',
                    partName: 'partName1',
                    specialName: 'specialName-string',
                    location: 'location-string',
                    principle: 'principle-string',
                    division: 'division-string',
                    consume: true,
                    custCountry: 'custCountry-string',
                    custPartCode: 'custPartCode-string',
                    productCategoryCode: 'productCategoryCode-string',
                    partCategory: 'partCategory-string',
                    minPackSize: 2,
                    overseaOnly: 'overseaOnly-string',
                    attachments: [
                        {
                            fileId: '1',
                            fileName: '附件1'
                        }, {
                            fileId: '2',
                            fileName: '附件2'
                        }, {
                            fileId: '3',
                            fileName: '附件3'
                        },
                    ]
                },
                {
                    brandCode: '品牌02',
                    partId: '2',
                    partCode: 'partCode2',
                    partName: 'partName2',
                    specialName: 'specialName-string',
                    location: 'location-string',
                    principle: 'principle-string',
                    division: 'division-string',
                    consume: false,
                    custCountry: 'custCountry-string',
                    custPartCode: 'custPartCode-string',
                    productCategoryCode: 'productCategoryCode-string',
                    partCategory: 'partCategory-string',
                    minPackSize: 3,
                    overseaOnly: 'overseaOnly-string',
                    attachments: [
                        {
                            fileId: '1',
                            fileName: '附件1'
                        }, {
                            fileId: '2',
                            fileName: '附件2'
                        }, {
                            fileId: '3',
                            fileName: '附件3'
                        },
                    ]
                }
            ]
        }
    });
});
router.post('/', (req, res) => {
    res.json({
        message: '新增'
    });
});
router.put('/:id', (req, res) => {
    res.json({
        message: '编辑'
    });
});
router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废'
    });
});
router.get('/export/forCurrentUser', (req, res) => {
    res.json({
        message: '导出'
    });
});
router.post('/import', (req, res) => {
    res.json({
        message: '申报要素导入'
    });
});
router.post('/partimport', (req, res) => {
    res.json({
        message: '申报要素备件对应关系导入'
    });
});
module.exports = router;
